package com.erp.servlet;

import com.erp.bean.Entrepot;
import com.erp.service.EntrepotService;
import com.erp.service.impl.EntrepotServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @author lyb
 * 创建仓库列表显示控制器
 *
 */
@WebServlet("/entrepotlist.action")
public class EntrepotListServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //创建仓库逻辑对象
        EntrepotService entrepotService=new EntrepotServiceImpl();
        List<Entrepot> entrepotList=entrepotService.findAll();
        req.setAttribute("entrepot",entrepotList);
        req.getRequestDispatcher("entrepotlist.jsp").forward(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
